<template>
    <div class="child">
        <h3>钱数:{{ modelValue }}</h3>
        <button @click="sendMsg2Father">父子组件数据同步</button>
    </div>
</template>

<script setup lang="ts">
  //接受props
  let props = defineProps(["modelValue"]);
  // 接收自定义事件
  let $emit = defineEmits(["update:modelValue"]);
  //子组件内部按钮的点击回调
  const sendMsg2Father = () => {
    //触发自定义事件
    $emit("update:modelValue", props.modelValue + 1000);
  };
</script>

<style scoped>
    .child {
        width: 600px;
        height: 300px;
        background: skyblue;
    }
</style>